const nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];

let newNums = [];
for (const n of nums) { 
    if (n < 100) {
        newNums.push(n);
    }
}
console.log(newNums); 
let newNewNums = [];
for (const n of newNums) {
    newNewNums.push(n * 2); 
}
console.log(newNewNums); 
let total = 0;
for (const n of newNewNums) {
    total += n;
}
console.log(total); 
let newNums1 = nums.filter(function(n) { 
    return n < 100;
});
console.log(newNums1); 
let total1 = newNewNums1.reduce(function(){

})
console.log(total1);
let totalnums = nums.fliter (function(n)  { return n < 100; })
.map(function(n) { return n * 2; })
.reduce(function(total, n) { return total + n; });
console.log(totalnums);